<?php
/**
 *
 * 版权所有：恰维网络<qwadmin.qiawei.com>
 * 作    者：寒川<hanchuan@qiawei.com>
 * 日    期：2016-09-20
 * 版    本：1.0.0
 * 功能说明：后台首页控制器。
 *
 **/

namespace Qwadmin\Controller;

class CheController extends ComController
{
   
	public function index()
	{
	    $list = M('safe')->select();
	    $y_list = M('card')->where(array('type'=>1))->select();
	    $this->assign('ylist',$y_list) ;
	    $this->assign('list',$list);
		$this->display();
	}




	//油卡录入
    public function ykadd()
    {

      // dump($_POST);
      // exit;
      $list = $_POST;
      $list['time'] = date('Y-m-d');
      $z_id = M('auth_group_access')->where(array('uid'=>$_SESSION['uid']))->select();
      $dada = M('member')->where(array('uid'=>$_SESSION['uid']))->select();
      $b_id = $z_id[0]['group_id'];
      $m_list = M('auth_group')->where(array('id'=>$b_id))->select();

        // dump($m_list);
        // exit;
      $list['ment'] = $m_list[0]['title'];
      $list['uname'] = $dada[0]['user']; 

      if (M('card')->add($list) > 0 ) {
          echo '1111';
      }else{
          echo '2222';
      }


    }




 	//申请派车
    public function cheadd()
    {
      
      // dump(I());
      // exit;


        $dada = M('member')->where(array('uid'=>$_SESSION['uid']))->select();
        $z_id = M('auth_group_access')->where(array('uid'=>$_SESSION['uid']))->select();
                
        $b_id = $z_id[0]['group_id'];
        $m_list = M('auth_group')->where(array('id'=>$b_id))->select();
        // dump($dada[0]['m_type']);
        // exit;
            switch ($dada[0]['m_type']) {
                  case '2':  //主管
                        // dump($_POST);
                        // exit;
                        if ($m_list[0]['post'] == '行政中心') {
                            
                            $list = $_POST;
                            $list['time'] = date('Y-m-d');
                            $list['ment'] = $m_list[0]['post'];
                            $list['uname'] = $dada[0]['user'];
                            $list['look'] = '8';  
                            if (M('turn')->add($list) > 0) {
                                $llist = M('turn')->where(['uname'=>$list['uname'],'type'=>$list['type']])->order('id desc')->limit(1)->select();
                                $date['zname'] = $dada[0]['user'];
                                $date['ztype'] = $dada[0]['m_type'];
                                $date['type'] = $_POST['type'];
                                $date['stype'] = 1;
                                $date['ztime'] = date('Y-m-d');
                                $date['sid'] = $llist[0]['id'];

                               if (M('che')->add($date) > 0) {
                                     $this->success('申请成功');
                                } 

                            }else{
                                $this->error('申请失败');
                            }



                        }else{
                            if ($m_list[0]['post'] == '采购中心') {

                                
                                $list = $_POST;
                                $list['time'] = date('Y-m-d');
                                $list['ment'] = $m_list[0]['post'];
                                $list['uname'] = $dada[0]['user']; 
                                $list['look'] = '9';
                                if (M('turn')->add($list) > 0) {
                                    $llist = M('turn')->where(['uname'=>$list['uname'],'type'=>$list['type']])->order('id desc')->limit(1)->select();
                                    $date['zname'] = $dada[0]['user'];
                                    $date['ztype'] = $dada[0]['m_type'];
                                    $date['stype'] = 1;
                                    $date['ztime'] = date('Y-m-d');
                                    $date['sid'] = $llist[0]['id'];
                                    $date['type'] = $_POST['type'];

                                    if (M('che')->add($date) > 0) {
                                      $this->success('申请成功');
                                    } 

                                }else{
                                    $this->error('申请失败');
                                }


                              
                            }else{
                                if ($m_list[0]['post'] == '财务中心') {
                                    
                                    $list = $_POST;
                                    $list['time'] = date('Y-m-d');
                                    $list['ment'] = $m_list[0]['post'];
                                    $list['uname'] = $dada[0]['user']; 
                                    $list['look'] = '10'; 
                                    if (M('turn')->add($list) > 0) {
                                        $llist = M('turn')->where(['uname'=>$list['uname'],'type'=>$list['type']])->order('id desc')->limit(1)->select();
                                        $date['zname'] = $dada[0]['user'];
                                        $date['ztype'] = $dada[0]['m_type'];
                                        $date['stype'] = 1;
                                        $date['ztime'] = date('Y-m-d');
                                        $date['sid'] = $llist[0]['id'];
                                        $date['type'] = $_POST['type'];

                                       if (M('che')->add($date) > 0) {
                                      $this->success('申请成功');
                                    } 

                                }else{
                                    $this->error('申请失败');
                                }
                                }else{
                                  // echo '12';
                                  // exit;
                                    
                                    $list = $_POST;
                                    $list['time'] = date('Y-m-d');
                                    $list['ment'] = $m_list[0]['post'];
                                    $list['uname'] = $dada[0]['user'];
                                    $list['look'] = '1';
                                    // dump($list);
                                    // exit;  
                                    if (M('turn')->add($list) > 0) {
                                        $llist = M('turn')->where(['uname'=>$list['uname'],'type'=>$list['type']])->order('id desc')->limit(1)->select();
                                        $date['zname'] = $dada[0]['user'];
                                        $date['ztype'] = $dada[0]['m_type'];
                                        $date['stype'] = 1;
                                        $date['ztime'] = date('Y-m-d');
                                        $date['sid'] = $llist[0]['id'];
                                        $date['type'] = $_POST['type'];

                                       if (M('che')->add($date) > 0) {
                                      $this->success('申请成功');
                                    } 

                                }else{
                                    $this->error('申请失败');
                                }
                                }
                            }
                        }
                    break;
                  case '3':  //经理
                      
                      $list = $_POST;
                      $list['time'] = date('Y-m-d');
                      $list['ment'] = $m_list[0]['post'];
                      $list['uname'] = $dada[0]['user'];  
                      $list['look'] = '2';
                      if (M('turn')->add($list) > 0) {
                          $llist = M('turn')->where(['uname'=>$list['uname'],'type'=>$list['type']])->order('id desc')->limit(1)->select();
                          $date['jname'] = $dada[0]['user'];
                          $date['jtype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['jtime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                          $date['type'] = $_POST['type'];

                          if (M('che')->add($date) > 0) {
                                      $this->success('申请成功');
                                    } 

                                }else{
                                    $this->error('申请失败');
                                }
                    break;
                  case '4':  //行政
                      
                       $list = $_POST;
                       // dump($list);
                       // exit;
                      $list['time'] = date('Y-m-d');
                      $list['ment'] = $m_list[0]['post'];
                      $list['uname'] = $dada[0]['user'];  
                       $list['look'] = '8';
                      if (M('turn')->add($list) > 0) {
                          $llist = M('turn')->where(['uname'=>$list['uname'],'type'=>$list['type']])->order('id desc')->limit(1)->select();
                          $date['zname'] = $dada[0]['user'];
                          $date['ztype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['ztime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                          $date['type'] = $_POST['type'];

                          if (M('che')->add($date) > 0) {
                                      $this->success('申请成功');
                                    } 

                                }else{
                                    $this->error('申请失败');
                                }
                    break;
                  case '5':   //财务
                       
                       $list = $_POST;
                      $list['time'] = date('Y-m-d');
                      $list['ment'] = $m_list[0]['post'];
                      $list['uname'] = $dada[0]['user']; 
                      $list['look'] = '10'; 
                      if (M('turn')->add($list) > 0) {
                          $llist = M('turn')->where(['uname'=>$list['uname'],'type'=>$list['type']])->order('id desc')->limit(1)->select();
                          $date['zname'] = $dada[0]['user'];
                          $date['ztype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['ztime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                          $date['type'] = $_POST['type'];                                                                                                                                                                                                                                                                                                                                                                                                     

                          if (M('che')->add($date) > 0) {
                                      $this->success('申请成功');
                                    } 

                                }else{
                                    $this->error('申请失败');
                                }
                    break;
                  case '10':   //财务
                       
                      $list = $_POST;
                      $list['time'] = date('Y-m-d');
                      $list['ment'] = $m_list[0]['post'];
                      $list['uname'] = $dada[0]['user']; 
                      $list['look'] = '10'; 
                      if (M('turn')->add($list) > 0) {
                          $llist = M('turn')->where(['uname'=>$list['uname'],'type'=>$list['type']])->order('id desc')->limit(1)->select();
                          $date['zname'] = $dada[0]['user'];
                          $date['ztype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['ztime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                          $date['type'] = $_POST['type'];

                          if (M('che')->add($date) > 0) {
                                      $this->success('申请成功');
                                    } 

                                }else{
                                    $this->error('申请失败');
                                }
                    break;
                  case '8':   //职能总
                      
                       $list = $_POST;
                      $list['time'] = date('Y-m-d');
                      $list['ment'] = $m_list[0]['post'];
                      $list['uname'] = $dada[0]['user']; 
                       $list['look'] = '2'; 
                      if (M('turn')->add($list) > 0) {
                          $llist = M('turn')->where(['uname'=>$list['uname'],'type'=>$list['type']])->order('id desc')->limit(1)->select();
                          $date['jname'] = $dada[0]['user'];
                          $date['jtype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['jtime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                          $date['type'] = $_POST['type'];

                          if (M('che')->add($date) > 0) {
                                      $this->success('申请成功');
                                    } 

                                }else{
                                    $this->error('申请失败');
                                }
                    break;
                  case '9':   //网络总
                      
                       $list = $_POST;
                      $list['time'] = date('Y-m-d');
                      $list['ment'] = $m_list[0]['post'];
                      $list['uname'] = $dada[0]['user']; 
                       $list['look'] = '2'; 
                      if (M('turn')->add($list) > 0) {
                          $llist = M('turn')->where(['uname'=>$list['uname'],'type'=>$list['type']])->order('id desc')->limit(1)->select();
                          $date['jname'] = $dada[0]['user'];
                          $date['jtype'] = $dada[0]['m_type'];
                          $date['stype'] = 1;
                          $date['jtime'] = date('Y-m-d');
                          $date['sid'] = $llist[0]['id'];
                          $date['type'] = $_POST['type'];

                          if (M('che')->add($date) > 0) {
                                      $this->success('申请成功');
                                    } 

                                }else{
                                    $this->error('申请失败');
                                }
                    break;
                case '0':
                      $list = $_POST;

                      $list['time'] = date('Y-m-d');
                      $list['ment'] = $m_list[0]['post'];
                      $list['uname'] = $dada[0]['user'];
                      // dump($list);
                      // exit;
                     if (M('turn')->add($list) > 0) {
                          $this->success('申请成功');
                      }else{
                          $this->error('申请失败');
                      }
                    break;
            }





    }








	//车辆保险录入
    public function chep()
    {
      // dump($_POST);
      $list = $_POST;

      $upload = new \Think\Upload();// 实例化上传类
      $upload->maxSize = 3145728 ;// 设置附件上传大小
      $upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
      $upload->rootPath = './Public/Uploads/'; // 设置附件上传根目录
      $upload->savePath = ''; // 设置附件上传（子）目录
      // 上传文件
      $info = $upload->upload();
      // dump($info);
      // exit;
      $idata = $info['photo']['savepath'].$info['photo']['savename'];
      // 缩略图片打开地址拼接
      $imgname = "/Uploads/".$idata;
      // echo $imgname;
      // exit;
      $list['img'] = $imgname;
      $list['time'] = date('Y-m-d');




      // dump($list);
      if (M('safe')->add($list) > 0) {
          $this->success('上传成功!!!');
      }else{
          $this->error('上传失败!!!');
      }



      
    }










    //派车申请
    public function paiche()
    {
    	$this->display();
    }





  //展示派车申请列表
  public function che()
  {

    $gid = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
    // dump($gid);
    // exit;
    $glist = M('auth_group')->where(['id'=>$gid[0]['group_id']])->select();  //权限
    // dump($type);
    // exit;
    $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();  //用户
    $apost = $glist[0]['post'];


    switch ($ulist[0]['m_type']) {
      case '2': //主管
        // echo '111';
        // exit;
        $db = M("turn");
        $count = $db->where(['type'=>1,'look'=>0,'ju'=>0])->count();
        $pagecount = 8;
        $page = new \Think\Page($count , $pagecount);
        // $row[] = '';
        $page->parameter = $row; //此处的row是数组，为了传递查询条件
        $page->setConfig('first');
        $page->setConfig('prev','上一页');
        $page->setConfig('next','下一页');
        $page->setConfig('last','尾页');
        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
        $show = $page->show();
        $list = $db->where(['type'=>1,'look'=>0,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
        $title = '部门市内派车申请';
        // dump($list);
        // exit;
        $this->assign('list',$list);
        $this->assign('page',$show);
        $this->assign('title',$title);
        $this->display();
        break;
      case '3': //经理
        switch ($apost) {
                case '行政中心':
                    $db = M("turn");
                    // echo '111';
                    // exit;
                        // $where = "a_id=".$uid;
                        $count = $db->where(['look'=>2,'type'=>1,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 10;
                        $page = new \Think\Page($count , $pagecount);
                        // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>2,'type'=>1,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '公司市内派车申请';
                        $xing = 1;

                        //---------------------------------------
                       
          
                        $this->assign('list',$list);
                        $this->assign('lei',$lei);
                        $this->assign('xing',$xing);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                    $this->display();
                  break;

                case '采购中心':
                    $db = M("turn");
                    // echo '111';
                    // exit;
                        // $where = "a_id=".$uid;
                        $count = $db->where(['look'=>9,'type'=>1,'ment'=>$apost,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 10;
                        $page = new \Think\Page($count , $pagecount);
                        // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>9,'type'=>1,'ment'=>$apost,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '部门市内派车申请';


                        //---------------------------------------
                       
                    
                        $this->assign('list',$list);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                    $this->display();
                  break;
                case '财务中心':
                    $db = M("turn");
                    
                        $count = $db->where(['look'=>10,'type'=>1,'ment'=>$apost,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 10;
                        $page = new \Think\Page($count , $pagecount);
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>10,'type'=>1,'ment'=>$apost,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '部门市内派车申请';


                        //---------------------------------------
            
                        $this->assign('list',$list);
                        $this->assign('lei',$lei);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                    $this->display();
                  break;
                
                
              }
        break;
      case '4': //行政
        
        $db = M("turn");
        $count = $db->where(['type'=>1,'look'=>2,'ju'=>0])->count();
        $pagecount = 8;
        $page = new \Think\Page($count , $pagecount);
        // $row[] = '';
        $page->parameter = $row; //此处的row是数组，为了传递查询条件
        $page->setConfig('first');
        $page->setConfig('prev','上一页');
        $page->setConfig('next','下一页');
        $page->setConfig('last','尾页');
        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
        $show = $page->show();
        $list = $db->where(['type'=>1,'look'=>2,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
        $title = '公司市内派车申请';
        // dump($list);
        // exit;
        $this->assign('list',$list);
        $this->assign('page',$show);
        $this->assign('title',$title);
        $this->display();
        break;
      case '9':  //职能总经理
              $db = M("turn");
              $mlist = M('auth_group')->where(['mtype'=>2])->select();

              foreach ($mlist as $vn) {
            
                $ments[] =  $vn['title'];
              

              }
               $where = [
                      'ment' => [
                          'in',
                          $ments
                      ],
                      'look' => 1,
                      'type'=>1,
                      'ju'   => 0

                  ];

                
                  $count = $db->where($where)->count();
                  
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where($where)->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门市内派车申请';
                  // dump($list);
                  // exit;
                
                  $this->assign('list',$list);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
                  $this->display();
            break;




          case '8':  //网络中心总经理
              $db = M("turn");
              $mlist = M('auth_group')->where(['mtype'=>1])->select();

              foreach ($mlist as $vn) {
              // echo $v['n_id'];
              // exit;
              // $ment .= "`ment`="."'".$vn['title']."'"." or ";
              // $ment .= "'".$vn['title']."'"." , ";
                $ments[] =  $vn['title'];
                // 

              }
               $where = [
                      'ment' => [
                          'in',
                          $ments
                      ],
                      'look' => 1,
                      'type'=>1,
                      'ju'   => 0

                  ];

                  // dump($where);
                  // exit;
                  // $where = "a_id=".$uid;
                  $count = $db->where($where)->count();
                  // dump($count);
                  // exit;
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where($where)->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门市内派车申请';
                 
                  $this->assign('list',$list);
                  // $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
                  $this->display();
            break;


          case '6':  //董事办
              $db = M("turn");
                  // $where = "a_id=".$uid;
                  $count = $db->where(['type'=>2,'look'=>3,'ju'=>0])->count();
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(['type'=>2,'look'=>3,'ju'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '公司市外派车申请';
                  $lei = 1;
                 
                  $this->assign('coun',$coun);
                  $this->assign('list',$list);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
                  $this->display('chew');
            break;
    }



  }

//展示市外派车申请列表
  public function chew()
  {

    $gid = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
    // dump($gid);
    // exit;
    $glist = M('auth_group')->where(['id'=>$gid[0]['group_id']])->select();  //权限
    // dump($type);
    // exit;
    $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();  //用户
    $apost = $glist[0]['post'];


    switch ($ulist[0]['m_type']) {
      case '2': //主管
        // echo '111';
        // exit;
        $db = M("turn");
        $count = $db->where(['type'=>2,'look'=>0,'ju'=>0])->count();
        $pagecount = 8;
        $page = new \Think\Page($count , $pagecount);
        // $row[] = '';
        $page->parameter = $row; //此处的row是数组，为了传递查询条件
        $page->setConfig('first');
        $page->setConfig('prev','上一页');
        $page->setConfig('next','下一页');
        $page->setConfig('last','尾页');
        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
        $show = $page->show();
        $list = $db->where(['type'=>2,'look'=>0,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
        $title = '部门市(外)派车申请';
        // dump($list);
        // exit;
        $this->assign('list',$list);
        $this->assign('page',$show);
        $this->assign('title',$title);
        $this->display();
        break;
      case '3': //经理
        switch ($apost) {
                case '行政中心':
                    $db = M("turn");
                    // echo '111';
                    // exit;
                        // $where = "a_id=".$uid;
                        $count = $db->where(['look'=>2,'type'=>2,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 10;
                        $page = new \Think\Page($count , $pagecount);
                        // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>2,'type'=>2,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '公司市外派车申请';


                        //---------------------------------------
                        $xing = 1;
          
                        $this->assign('list',$list);
                        $this->assign('xing',$xing);
                        $this->assign('cao',$cao);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                        $this->display();
                  break;

                case '采购中心':
                    $db = M("turn");
                    // echo '111';
                    // exit;
                        // $where = "a_id=".$uid;
                        $count = $db->where(['look'=>9,'type'=>2,'ment'=>$apost,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 10;
                        $page = new \Think\Page($count , $pagecount);
                        // $row[] = '';
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>9,'type'=>2,'ment'=>$apost,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '部门市外派车申请';


                        //---------------------------------------
                       
                    
                        $this->assign('list',$list);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                        $this->display();
                  break;
                case '财务中心':
                    $db = M("turn");
                    
                        $count = $db->where(['look'=>10,'type'=>2,'ment'=>$apost,'ju'=>0])->count();
                        // dump($count);
                        // exit;
                        $pagecount = 10;
                        $page = new \Think\Page($count , $pagecount);
                        $page->parameter = $row; //此处的row是数组，为了传递查询条件
                        $page->setConfig('first');
                        $page->setConfig('prev','上一页');
                        $page->setConfig('next','下一页');
                        $page->setConfig('last','尾页');
                        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                        $show = $page->show();
                        $list = $db->where(['look'=>10,'type'=>2,'ment'=>$apost,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
                        $title = '部门市外派车申请';


                        //---------------------------------------
            
                        $this->assign('list',$list);
                        $this->assign('lei',$lei);
                       
                        $this->assign('page',$show);
                        
                        $this->assign('title',$title);
                        $this->display();
                  break;
                
                
              }
        break;
      case '4': //行政
        
        $db = M("turn");
        $count = $db->where(['type'=>2,'look'=>2,'ju'=>0])->count();
        $pagecount = 8;
        $page = new \Think\Page($count , $pagecount);
        // $row[] = '';
        $page->parameter = $row; //此处的row是数组，为了传递查询条件
        $page->setConfig('first');
        $page->setConfig('prev','上一页');
        $page->setConfig('next','下一页');
        $page->setConfig('last','尾页');
        $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
        $show = $page->show();
        $list = $db->where(['type'=>2,'look'=>2,'ju'=>0])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
        $title = '公司市外派车申请';
        // dump($list);
        // exit;
        $this->assign('list',$list);
        $this->assign('page',$show);
        $this->assign('title',$title);
        $this->display();
        break;
      case '9':  //职能总经理
              $db = M("turn");
              $mlist = M('auth_group')->where(['mtype'=>2])->select();

              foreach ($mlist as $vn) {
            
                $ments[] =  $vn['title'];
              

              }
               $where = [
                      'ment' => [
                          'in',
                          $ments
                      ],
                      'look' => 1,
                      'type'=>2,
                      'ju'   => 0

                  ];

                
                  $count = $db->where($where)->count();
                  
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where($where)->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门市外派车申请';
                  // dump($list);
                  // exit;
                
                  $this->assign('list',$list);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
                  $this->display();
            break;




          case '8':  //网络中心总经理
              $db = M("turn");
              $mlist = M('auth_group')->where(['mtype'=>1])->select();

              foreach ($mlist as $vn) {
              // echo $v['n_id'];
              // exit;
              // $ment .= "`ment`="."'".$vn['title']."'"." or ";
              // $ment .= "'".$vn['title']."'"." , ";
                $ments[] =  $vn['title'];
                // 

              }
               $where = [
                      'ment' => [
                          'in',
                          $ments
                      ],
                      'look' => 1,
                      'type'=>2,
                      'ju'   => 0

                  ];

                  // dump($where);
                  // exit;
                  // $where = "a_id=".$uid;
                  $count = $db->where($where)->count();
                  // dump($count);
                  // exit;
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where($where)->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '部门市外派车申请';
                 
                  $this->assign('list',$list);
                  // $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
                  $this->display();
            break;


          case '6':  //董事办
              $db = M("look");
                  // $where = "a_id=".$uid;
                  $count = $db->where(['type'=>2,'look'=>4,'ju'=>0])->count();
                  $pagecount = 10;
                  $page = new \Think\Page($count , $pagecount);
                  // $row[] = '';
                  $page->parameter = $row; //此处的row是数组，为了传递查询条件
                  $page->setConfig('first');
                  $page->setConfig('prev','上一页');
                  $page->setConfig('next','下一页');
                  $page->setConfig('last','尾页');
                  $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                  $show = $page->show();
                  $list = $db->where(['type'=>2,'look'=>4,'ju'=>0])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                  $title = '公司市外派车申请';
                  $lei = 1;
                 
                  $this->assign('coun',$coun);
                  $this->assign('list',$list);
                  $this->assign('lei',$lei);
                  $this->assign('page',$show);
                  $this->assign('title',$title);
                  $this->display();
            break;
    }



  }




//单个派车申请通过
  public function csh()
  {
    
    $sid = $_POST['id'];
    
    $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
    $gid = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
    $glist = M('auth_group')->where(['id'=>$gid[0]['group_id']])->select();
    $apost = $glist[0]['post'];
    // dump($apost);
    // exit;
    $data['sid'] = $sid;
    $data['stype'] = '1';
    if ($_POST['lei'] == 1) {
      $data['type'] = '1';
    }else{
      $data['type'] = '2';
    }
    // $ss = M('yue')->where(['sid'=>$sid])->select();
    // dump($ulist[0]['m_type']);
    // exit;
    switch ($ulist[0]['m_type']) {
      case '2': //主管
        $data['ztype'] = $ulist[0]['m_type'];
        $data['zname'] = $ulist[0]['user'];
        $data['ztime'] = date('Y-m-d');
        // dump($data);
        // exit;
        $look['look'] = '1';
        if (M('che')->add($data) > 0) {
          if (M('turn')->where(['id'=>$sid])->save($look) > 0) {
            echo '1111';
          }
        }
        break;
      case '3': //经理
        switch ($apost) {
          case '行政中心':
              $clist = M('che')->where(['sid'=>$sid])->find();
              if (empty($clist['jname'])) {
                $data['jtype'] = $ulist[0]['m_type'];
                $data['jname'] = $ulist[0]['user'];
                $data['jtime'] = date('Y-m-d');
                $look['look'] = '2';
                // dump($data);
                // exit;
                
                  if (M('che')->where(['sid'=>$sid])->save($data) > 0) {
                    if (M('turn')->where(['id'=>$sid])->save($look) > 0) {
                      echo '1111';
                    }
                  }
              }else{
                $data['xtype'] = $ulist[0]['m_type'];
                $data['xname'] = $ulist[0]['user'];
                $data['xtime'] = date('Y-m-d');
                $look['look'] = '3';
                // dump($data);
                // exit;
                
                  if (M('che')->where(['sid'=>$sid])->save($data) > 0) {
                    if (M('turn')->where(['id'=>$sid])->save($look) > 0) {
                      echo '1111';
                    }
                  }
              }
              
              
            break;
          case '采购中心':
              $data['jtype'] = $ulist[0]['m_type'];
              $data['jname'] = $ulist[0]['user'];
              $data['jtime'] = date('Y-m-d');
              $look['look'] = '2';
            
                if (M('che')->where(['sid'=>$sid])->save($data) > 0) {
                  if (M('turn')->where(['id'=>$sid])->save($look) > 0) {
                    echo '1111';
                  }
                }
              
            break;
          case '财务中心':
              $data['jtype'] = $ulist[0]['m_type'];
              $data['jname'] = $ulist[0]['user'];
              $data['jtime'] = date('Y-m-d');
              $look['look'] = '2';
            
                if (M('che')->where(['sid'=>$sid])->save($data) > 0) {
                  if (M('turn')->where(['id'=>$sid])->save($look) > 0) {
                    echo '1111';
                  }
                }
              
            break;
          
        }
        break;
      case '4': //行政
        
        $data['xtype'] = $ulist[0]['m_type'];
        $data['xname'] = $ulist[0]['user'];
        $data['xtime'] = date('Y-m-d');
        // dump($data);
        // exit;
        $look['look'] = '3';
        if (M('che')->where(['sid'=>$sid])->save($data) > 0) {
          if (M('turn')->where(['id'=>$sid])->save($look) > 0) {
            echo '1111';
          }
        }
        break;
      case '6': //董事办
        
        $data['dtype'] = $ulist[0]['m_type'];
        $data['dname'] = $ulist[0]['user'];
        $data['dtime'] = date('Y-m-d');
        // dump($data);
        // exit;
        $look['look'] = '4';
        if (M('che')->where(['sid'=>$sid])->save($data) > 0) {
          if (M('turn')->where(['id'=>$sid])->save($look) > 0) {
            echo '1111';
          }
        }
        break;
      case '9': //职能总经理
        $data['jtype'] = $ulist[0]['m_type'];
        $data['jname'] = $ulist[0]['user'];
        $data['jtime'] = date('Y-m-d');
        // dump($data);
        // exit;
        $look['look'] = '2';
        if (M('che')->where(['sid'=>$sid])->save($data) > 0) {
          if (M('turn')->where(['id'=>$sid])->save($look) > 0) {
            echo '1111';
          }
        }
        
        
        break;
      case '8': //网络总经理
        
        $data['jtype'] = $ulist[0]['m_type'];
        $data['jname'] = $ulist[0]['user'];
        $data['jtime'] = date('Y-m-d');
        $look['look'] = '2';
      
        if (M('che')->where(['sid'=>$sid])->save($data) > 0) {
          if (M('turn')->where(['id'=>$sid])->save($look) > 0) {
            echo '1111';
          }
        }
        
        break;

    }




  }




//派车申请一键通过
  public function ctong()
  {
    $llist = $_POST;
    foreach ($llist as $k => $v) {
      // dump();
      // for ($i=0; $i <= $k ; $i++) { 
      //  # code...
      // }
      $ment[]= $v;

      
    }
    $ments = $ment[0];
    $data['stype'] = '1';
  
      $data['type'] = '1';
  

    $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
    $alist = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
    $glist = M('auth_group')->where(['id'=>$alist[0]['group_id']])->select();
    $ss = M('yue')->where(['sid'=>['in',$ments]])->select();
    // dump($ss);
    // exit;
    switch ($ulist[0]['m_type']) {
      case '2':  //主管
        $data['ztype'] = $ulist[0]['m_type'];
        
        $data['zname'] = $ulist[0]['user'];
        $data['ztime'] = date('Y-m-d');
        $look['look'] = '1';
        // dump($data);
        // exit;

            $c = [];
            foreach ($ments as $k => $v) {
                $c[$k]['sid'] = $v;
                $c[$k]['ztype'] = $data['ztype'];
                $c[$k]['zname'] = $data['zname'];
                $c[$k]['ztime'] = $data['ztime'];
                $c[$k]['stype'] = $data['stype'];
                $c[$k]['type'] = $data['type'];
            }
            // dump($c);
            // exit;

        if (M('che')->addAll($c) > 0) {
          if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
            echo '1111';
          }
        }
        break;
      

      case '3':  //经理
        switch ($glist[0]['post']) {
          case '行政中心':

            $data['xtype'] = $ulist[0]['m_type'];
        
            $data['xname'] = $ulist[0]['user'];
            $data['xtime'] = date('Y-m-d');
            $look['look'] = '3';
            // dump($data);
            // exit;
          
              if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
                if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
                  echo '1111';
                }
              }
            
            break;
          case '采购中心':
            $data['jtype'] = $ulist[0]['m_type'];
        
            $data['jname'] = $ulist[0]['user'];
            $data['jtime'] = date('Y-m-d');
            $look['look'] = '2';
            // dump($data);
            // exit;
          

          
              if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
                if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
                  echo '1111';
                }
              }
            
            break;
          case '财务中心':
            $data['jtype'] = $ulist[0]['m_type'];
        
            $data['jname'] = $ulist[0]['user'];
            $data['jtime'] = date('Y-m-d');
            $look['look'] = '2';
          

          
              if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
                if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
                  echo '1111';
                }
              }
          
            break;
          
          
        }
        break;


      case '4':  //行政
        // $cha = M('look')->where(['id'=>['in',$ments]])->find();
        // dump($cha);
        // exit;
        $data['xtype'] = $ulist[0]['m_type'];
        
        $data['xname'] = $ulist[0]['user'];
        $data['xtime'] = date('Y-m-d');
        $look['look'] = '3';
        // dump($data);

        if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
          if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
            echo '1111';
          }
        }
        break;
      


      case '9':  //职能总经理
        $data['jtype'] = $ulist[0]['m_type'];
        
        $data['jname'] = $ulist[0]['user'];
        $data['jtime'] = date('Y-m-d');
        $look['look'] = '2';
      
        
          if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
            if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
              echo '1111';
            }
          }
        
      
        break;
      case '8':  //网络总经理
        $data['jtype'] = $ulist[0]['m_type'];
        
        $data['jname'] = $ulist[0]['user'];
        $data['jtime'] = date('Y-m-d');
        $look['look'] = '2';
        
        // dump($data);

        
          if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
            if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
              echo '1111';
            }
          }
        
        // if (M('yue')->where(['sid'=>['in',$ments]])->save($data) > 0) {
        //  if (M('look')->where(['id'=>['in',$ments]])->save($look) > 0) {
        //    echo '1111';
        //  }
        // }
        break;

      case '6':  //董事办
        $data['dtype'] = $ulist[0]['m_type'];
        
        $data['dname'] = $ulist[0]['user'];
        $data['dtime'] = date('Y-m-d');
        $look['look'] = '4';
        
        
          if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
            if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
              echo '1111';
            }
          }
        
        break;

      
    }
  }

  //市外派车申请一键通过
  public function cwtong()
  {
    $llist = $_POST;
    foreach ($llist as $k => $v) {
      // dump();
      // for ($i=0; $i <= $k ; $i++) { 
      //  # code...
      // }
      $ment[]= $v;

      
    }
    $ments = $ment[0];
    $data['stype'] = '1';
    
      $data['type'] = '2';
    

    $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
    $alist = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
    $glist = M('auth_group')->where(['id'=>$alist[0]['group_id']])->select();
    $ss = M('yue')->where(['sid'=>['in',$ments]])->select();
    // dump($ss);
    // exit;
    switch ($ulist[0]['m_type']) {
      case '2':  //主管
        $data['ztype'] = $ulist[0]['m_type'];
        
        $data['zname'] = $ulist[0]['user'];
        $data['ztime'] = date('Y-m-d');
        $look['look'] = '1';
        // dump($data);
        // exit;

            $c = [];
            foreach ($ments as $k => $v) {
                $c[$k]['sid'] = $v;
                $c[$k]['ztype'] = $data['ztype'];
                $c[$k]['zname'] = $data['zname'];
                $c[$k]['ztime'] = $data['ztime'];
                $c[$k]['stype'] = $data['stype'];
                $c[$k]['type'] = $data['type'];
            }
            // dump($c);
            // exit;

        if (M('che')->addAll($c) > 0) {
          if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
            echo '1111';
          }
        }
        break;
      

      case '3':  //经理
        switch ($glist[0]['post']) {
          case '行政中心':

            $data['xtype'] = $ulist[0]['m_type'];
        
            $data['xname'] = $ulist[0]['user'];
            $data['xtime'] = date('Y-m-d');
            $look['look'] = '3';
            // dump($data);
            // exit;
          
              if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
                if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
                  echo '1111';
                }
              }
            
            break;
          case '采购中心':
            $data['jtype'] = $ulist[0]['m_type'];
        
            $data['jname'] = $ulist[0]['user'];
            $data['jtime'] = date('Y-m-d');
            $look['look'] = '2';
            // dump($data);
            // exit;
          

          
              if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
                if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
                  echo '1111';
                }
              }
            
            break;
          case '财务中心':
            $data['jtype'] = $ulist[0]['m_type'];
        
            $data['jname'] = $ulist[0]['user'];
            $data['jtime'] = date('Y-m-d');
            $look['look'] = '2';
          

          
              if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
                if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
                  echo '1111';
                }
              }
          
            break;
          
          
        }
        break;


      case '4':  //行政
        // $cha = M('look')->where(['id'=>['in',$ments]])->find();
        // dump($cha);
        // exit;
        $data['xtype'] = $ulist[0]['m_type'];
        
        $data['xname'] = $ulist[0]['user'];
        $data['xtime'] = date('Y-m-d');
        $look['look'] = '3';
        // dump($data);

        if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
          if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
            echo '1111';
          }
        }
        break;
      


      case '9':  //职能总经理
        $data['jtype'] = $ulist[0]['m_type'];
        
        $data['jname'] = $ulist[0]['user'];
        $data['jtime'] = date('Y-m-d');
        $look['look'] = '2';
      
        
          if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
            if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
              echo '1111';
            }
          }
        
      
        break;
      case '8':  //网络总经理
        $data['jtype'] = $ulist[0]['m_type'];
        
        $data['jname'] = $ulist[0]['user'];
        $data['jtime'] = date('Y-m-d');
        $look['look'] = '2';
        
        // dump($data);

        
          if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
            if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
              echo '1111';
            }
          }
        
        // if (M('yue')->where(['sid'=>['in',$ments]])->save($data) > 0) {
        //  if (M('look')->where(['id'=>['in',$ments]])->save($look) > 0) {
        //    echo '1111';
        //  }
        // }
        break;

      case '6':  //董事办
        $data['dtype'] = $ulist[0]['m_type'];
        
        $data['dname'] = $ulist[0]['user'];
        $data['dtime'] = date('Y-m-d');
        $look['look'] = '4';
        
        
          if (M('che')->where(['sid'=>['in',$ments]])->save($data) > 0) {
            if (M('turn')->where(['id'=>['in',$ments]])->save($look) > 0) {
              echo '1111';
            }
          }
        
        break;

      
    }
  }

//派车申请单次拒绝操作
  public function cju()
  {

      $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
      $alist = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
      $glist = M('auth_group')->where(['id'=>$alist[0]['group_id']])->select();
      $llist = M('look')->where(['id'=>$_POST['id']])->find();
      $data['stype'] = '2';
      $data['content'] = $_POST['cent'];
      $data['type'] = $_POST['type'];
     // switch ($_POST['type']) {
     //   case '1':
     //     $data['type'] = $_POST['cent'];
     //     break;
    
     
     

          switch ($ulist[0]['m_type']) {
              case '2':  //主管
                $data['ztype'] = $ulist[0]['m_type'];
                    
                $data['zname'] = $ulist[0]['user'];
                $data['ztime'] = date('Y-m-d');
                $data['sid'] = $_POST['id'];
                // $data['cent'] = $_POST['cent'];
                // $data['stype'] = '2';
                $look['ju'] = '1';
                        // dump($data);
                        // exit;

                if (M('che')->add($data) > 0) {
                  if (M('turn')->where(['id'=>$_POST['id']])->save($look) > 0) {
                    echo '1111';
                  }
                }
                break;
              case '3': //经理/总监
                    switch ($glist[0]['post']) {
                      case '行政中心':
                        // $sid = $_POST['id']; 
                        $ylist = M('che')->where(['sid'=>$_POST['id']])->find();
                        // dump($ylist);
                        // exit;
                        if (empty($ylist['jname'])) {
                          $data['jtype'] = $ulist[0]['m_type'];
                          $data['jname'] = $ulist[0]['user'];
                          $data['jtime'] = date('Y-m-d');
                          $look['ju'] = '2';
                          if (M('che')->where(['sid'=>$_POST['id']])->save($data) > 0) {
                            if (M('turn')->where(['id'=>$_POST['id']])->save($look) > 0) {
                              echo '1111';
                            }
                          }
                        }else{
                          $data['xtype'] = $ulist[0]['m_type'];
                          $data['xname'] = $ulist[0]['user'];
                          $data['xtime'] = date('Y-m-d');
                          $look['ju'] = '3';
                          if (M('che')->where(['sid'=>$_POST['id']])->save($data) > 0) {
                            if (M('turn')->where(['id'=>$_POST['id']])->save($look) > 0) {
                              echo '1111';
                            }
                          }
                        }
                        
                        break;
                      case '采购中心':
                        $data['jtype'] = $ulist[0]['m_type'];
                        $data['jname'] = $ulist[0]['user'];
                        $data['jtime'] = date('Y-m-d');
                        $look['ju'] = '2';
                        if (M('che')->where(['sid'=>$_POST['id']])->save($data) > 0) {
                          if (M('turn')->where(['id'=>$_POST['id']])->save($look) > 0) {
                            echo '1111';
                          }
                        }
                        break;
                      case '财务中心':
                          $ylist = M('che')->where(['sid'=>$_POST['id']])->find();
                          if (empty($ylist['jname'])) {
                            $data['jtype'] = $ulist[0]['m_type'];
                            $data['jname'] = $ulist[0]['user'];
                            $data['jtime'] = date('Y-m-d');
                            $look['ju'] = '2';
                            if (M('che')->where(['sid'=>$_POST['id']])->save($data) > 0) {
                              if (M('turn')->where(['id'=>$_POST['id']])->save($look) > 0) {
                                echo '1111';
                              }
                            }
                          }else{
                            $data['ctype'] = $ulist[0]['m_type'];
                            $data['cname'] = $ulist[0]['user'];
                            $data['ctime'] = date('Y-m-d');
                            $look['ju'] = '4';
                            if (M('che')->where(['sid'=>$_POST['id']])->save($data) > 0) {
                              if (M('turn')->where(['id'=>$_POST['id']])->save($look) > 0) {
                                echo '1111';
                              }
                            }
                          }
                          
                        
                        break;
                      
                    }

                    break;
              case '4':  //行政
                $data['xtype'] = $ulist[0]['m_type'];
                    
                $data['xname'] = $ulist[0]['user'];
                $data['xtime'] = date('Y-m-d');
                $data['sid'] = $_POST['id'];
                // $data['cent'] = $_POST['cent'];
                // $data['stype'] = '2';
                $look['ju'] = '3';
                        // dump($data);
                        // exit;
                if (M('che')->where(['sid'=>$_POST['id']])->save($data) > 0) {
                  if (M('turn')->where(['id'=>$_POST['id']])->save($look) > 0) {
                    echo '1111';
                  }
                }
                break;
             
              case '9':  //职能总经理
                $ylist = M('che')->where(['sid'=>$_POST['id']])->find();
                // dump($_POST['id']);
                // exit;
                if (empty($ylist['jname'])) {
                  $data['jtype'] = $ulist[0]['m_type'];
                  $data['jname'] = $ulist[0]['user'];
                  $data['jtime'] = date('Y-m-d');
                  $look['ju'] = '2';
                          // dump($data);

                  if (M('che')->where(['sid'=>$_POST['id']])->save($data) > 0) {
                    if (M('turn')->where(['id'=>$_POST['id']])->save($look) > 0) {
                      echo '1111';
                    }
                  }
                }else{
                  $data['gtype'] = $ulist[0]['m_type'];
                  $data['gname'] = $ulist[0]['user'];
                  $data['gtime'] = date('Y-m-d');
                  $look['ju'] = '5';
                          // dump($data);

                  if (M('che')->where(['sid'=>$_POST['id']])->save($data) > 0) {
                    if (M('turn')->where(['id'=>$_POST['id']])->save($look) > 0) {
                      echo '1111';
                    }
                  }
                }
                
                break;
              
              case '6':  //董事办
                $data['dtype'] = $ulist[0]['m_type'];
                $data['dname'] = $ulist[0]['user'];
                $data['dtime'] = date('Y-m-d');
                $look['ju'] = '4';
                if (M('che')->where(['sid'=>$_POST['id']])->save($data) > 0) {
                    if (M('turn')->where(['id'=>$_POST['id']])->save($look) > 0) {
                      echo '1111';
                    }
                  }
                break;
                
            }
   


    
  }



  //所有通过派车申请审批
  public function csuo()
  {
    $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
    $alist = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
    $glist = M('auth_group')->where(['id'=>$alist[0]['group_id']])->select();
    if (empty($_GET['type'])) {
      if ($ulist[0]['m_type'] >= 3) {
            $db = M("turn");
            // $where = "a_id=".$uid;
            $count = $db->where(['look'=>3,'ju'=>0,'type'=>1,'pay'=>0])->count();
            $pagecount = 15;
            $page = new \Think\Page($count , $pagecount);
                          // $row[] = '';
            $page->parameter = $row; //此处的row是数组，为了传递查询条件
            $page->setConfig('first','第一页');
            $page->setConfig('prev','上一页');
            $page->setConfig('next','下一页');
            $page->setConfig('last','尾页');
            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
            $show = $page->show();
            $list = $db->where(['look'=>3,'ju'=>0,'type'=>1,'pay'=>0])->order('time desc')->limit($page->firstRow.','.$page->listRows)->select();
            $title = '公司已通过市(内)派车审批';
            $this->assign('list',$list);
            if ($ulist[0]['m_type'] == '4') {
              $lei = '行政';
              $this->assign('lei',$lei);
            }
            // $this->assign('coun',$coun);
            // $this->assign('dao',$dao);
            // $this->assign('lei',$lei);
            $this->assign('page',$show);
            $this->assign('title',$title);
            $this->display();
        }else{
            $db = M("turn");
            // $where = "a_id=".$uid;
            $count = $db->where(['look'=>3,'ju'=>0,'uname'=>$uname,'type'=>1,'pay'=>0])->count();
            $pagecount = 15;
            $page = new \Think\Page($count , $pagecount);
                          // $row[] = '';
            $page->parameter = $row; //此处的row是数组，为了传递查询条件
            $page->setConfig('first','第一页');
            $page->setConfig('prev','上一页');
            $page->setConfig('next','下一页');
            $page->setConfig('last','尾页');
            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
            $show = $page->show();
            $list = $db->where(['look'=>3,'ju'=>0,'uname'=>$uname,'type'=>1,'pay'=>0])->order('time desc')->limit($page->firstRow.','.$page->listRows)->select();
            $title = '已通过市(内)派车审批';
            if ($ulist[0]['m_type'] == '4') {
              $lei = '行政';
              $this->assign('lei',$lei);
            }
            $this->assign('list',$list);
            // $this->assign('coun',$coun);
            // $this->assign('dao',$dao);
            // $this->assign('lei',$lei);
            $this->assign('page',$show);
            $this->assign('title',$title);
            $this->display();
        }
      
    }else{
          if ($ulist[0]['m_type'] >= 3) {
              $db = M("turn");
              $list = $db->where(['look'=>4,'ju'=>0,'type'=>2,'pay'=>0])->order('time desc')->limit(15)->select();
              // dump($list);
              // exit;
              $title = '公司已通过市(外)派车申请信息';
              if ($ulist[0]['m_type'] == '4') {
                $lei = '行政';
                $this->assign('lei',$lei);
              }                     
              $this->assign('list',$list);
              $this->assign('page',$show);
              $this->assign('title',$title);
              $this->display();
          }else{
              $db = M("turn");
              $list = $db->where(['look'=>4,'ju'=>0,'uname'=>$uname,'type'=>2,'pay'=>0])->order('time desc')->limit(15)->select();
              $title = '已通过市(外)派车申请信息';
              if ($ulist[0]['m_type'] == '4') {
                $lei = '行政';
                $this->assign('lei',$lei);
              }                                      
              $this->assign('list',$list);
              $this->assign('page',$show);
              $this->assign('title',$title);
              $this->display();
          }
      
     
      
    }




  }







  //添加派车回馈
  public function hadd()
  {
     
    // $list['cid']
    $list = $_POST;
    $list['s_time'] = $_POST['s_date'].'/'.$_POST['s_time'];
    $list['e_time'] = $_POST['e_date'].'/'.$_POST['e_time'];
    $list['f_type'] = $_POST['fei'];
    
    unset($list['s_date']);
    unset($list['e_date']);
    unset($list['fei']);
    $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
    
    $list['name'] = $ulist[0]['user'];
    $list['time'] = date('Y-m-d');
    // dump($list);
    // exit;
    $arr['pay'] = '1';
    if (M('hui')->add($list) > 0) {
        if (M('turn')->where(['id'=>$list['cid']])->save($arr) > 0) {
           $this->success('添加成功');
        }else{
          $this->error('添加失败');
        }
       
    }else{
        $this->error('添加失败');
    }




  }





  //查看派车回馈
  public function cha()
  {
      if (empty($_GET['type'])) {
      $db = M("hui");
      // $where = "a_id=".$uid;
      $count = $db->where(['type'=>1])->count();
      $pagecount = 9;
      $page = new \Think\Page($count , $pagecount);
                    // $row[] = '';
      $page->parameter = $row; //此处的row是数组，为了传递查询条件
      $page->setConfig('first');
      $page->setConfig('prev','上一页');
      $page->setConfig('next','下一页');
      $page->setConfig('last','尾页');
      $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
      $show = $page->show();
      $list = $db->where(['type'=>1])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
      $title = '市内派车反馈列表';
      // dump($list);
      // exit;

      $lei = 'nei';             
      $this->assign('lei',$lei);
      $this->assign('list',$list);
      // $this->assign('coun',$coun);
      // $this->assign('dao',$dao);
      // $this->assign('lei',$lei);
      $this->assign('page',$show);
      $this->assign('title',$title);
      $this->display();
    }else{
      $db = M("hui");
      // $where = "a_id=".$uid;
      $count = $db->where(['type'=>2])->count();
      $pagecount = 9;
      $page = new \Think\Page($count , $pagecount);
                    // $row[] = '';
      $page->parameter = $row; //此处的row是数组，为了传递查询条件
      $page->setConfig('first');
      $page->setConfig('prev','上一页');
      $page->setConfig('next','下一页');
      $page->setConfig('last','尾页');
      $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
      $show = $page->show();
      $list = $db->where(['type'=>2])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
      $title = '市外派车反馈列表';

      // dump($list);
      // exit;       
      $lei = 'wai';             
      $this->assign('lei',$lei);               
      $this->assign('list',$list);
      // $this->assign('coun',$coun);
      // $this->assign('dao',$dao);
      // $this->assign('lei',$lei);
      $this->assign('page',$show);
      $this->assign('title',$title);
      $this->display();
    }
  }







  public function cjue()
  {
    $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
    $alist = M('auth_group_access')->where(['uid'=>$_SESSION['uid']])->select();
    $glist = M('auth_group')->where(['id'=>$alist[0]['group_id']])->select();
    $apost = $glist[0]['post'];
    if (empty($_GET['type'])) {
          switch ($ulist[0]['m_type']) {
              case '2': //主管
                $db = M("turn");
                $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[2,3]],'oa_turn.type'=>'1','oa_turn.ment'=>$apost])->count();
                $pagecount = 10;
                $page = new \Think\Page($count , $pagecount);
                              // $row[] = '';
                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                $page->setConfig('first');
                $page->setConfig('prev','上一页');
                $page->setConfig('next','下一页');
                $page->setConfig('last','尾页');
                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                $show = $page->show();
                $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[2,3]],'oa_turn.type'=>'1','oa_turn.ment'=>$apost])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                $title = '已被拒绝的市(内)派车申请';

                         
                
                $this->assign('list',$list);
                // $this->assign('coun',$coun);
                // $this->assign('dao',$dao);
                // $this->assign('lei',$lei);
                $this->assign('page',$show);
                $this->assign('title',$title);
                $this->display();
                break;
              case '3': //经理
                switch ($apost) {
                        case '行政中心':
                                $db = M("turn");
                                $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'3','oa_turn.type'=>'1'])->count();
                                $pagecount = 10;
                                $page = new \Think\Page($count , $pagecount);
                                              // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'3','oa_turn.type'=>'1'])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                                $title = '已被拒绝的市(内)派车申请';

                                         
                                
                                $this->assign('list',$list);
                                // $this->assign('coun',$coun);
                                // $this->assign('dao',$dao);
                                // $this->assign('lei',$lei);
                                $this->assign('page',$show);
                                $this->assign('title',$title);
                                $this->display();
                          break;

                        case '采购中心':
                            $db = M("turn");
                            $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'3','oa_turn.type'=>'1','oa_turn.ment'=>$apost])->count();
                            $pagecount = 10;
                            $page = new \Think\Page($count , $pagecount);
                                          // $row[] = '';
                            $page->parameter = $row; //此处的row是数组，为了传递查询条件
                            $page->setConfig('first');
                            $page->setConfig('prev','上一页');
                            $page->setConfig('next','下一页');
                            $page->setConfig('last','尾页');
                            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                            $show = $page->show();
                            $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'3','oa_turn.type'=>'1','oa_turn.ment'=>$apost])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $title = '已被拒绝的市(内)派车申请';

                                     
                            
                            $this->assign('list',$list);
                            // $this->assign('coun',$coun);
                            // $this->assign('dao',$dao);
                            // $this->assign('lei',$lei);
                            $this->assign('page',$show);
                            $this->assign('title',$title);
                            $this->display();
                          break;
                        case '财务中心':
                            $db = M("turn");
                            $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'3','oa_turn.type'=>'1','oa_turn.ment'=>$apost])->count();
                            $pagecount = 10;
                            $page = new \Think\Page($count , $pagecount);
                                          // $row[] = '';
                            $page->parameter = $row; //此处的row是数组，为了传递查询条件
                            $page->setConfig('first');
                            $page->setConfig('prev','上一页');
                            $page->setConfig('next','下一页');
                            $page->setConfig('last','尾页');
                            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                            $show = $page->show();
                            $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'3','oa_turn.type'=>'1','oa_turn.ment'=>$apost])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $title = '已被拒绝的市(内)派车申请';

                                     
                            
                            $this->assign('list',$list);
                            // $this->assign('coun',$coun);
                            // $this->assign('dao',$dao);
                            // $this->assign('lei',$lei);
                            $this->assign('page',$show);
                            $this->assign('title',$title);
                            $this->display();
                          break;
                        
                        
                      }
                break;
              case '4': //行政
                
                $db = M("turn");
                $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'3','oa_turn.type'=>'1'])->count();
                $pagecount = 10;
                $page = new \Think\Page($count , $pagecount);
                              // $row[] = '';
                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                $page->setConfig('first');
                $page->setConfig('prev','上一页');
                $page->setConfig('next','下一页');
                $page->setConfig('last','尾页');
                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                $show = $page->show();
                $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'3','oa_turn.type'=>'1'])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                $title = '已被拒绝的市(内)派车申请';

                         
                
                $this->assign('list',$list);
                // $this->assign('coun',$coun);
                // $this->assign('dao',$dao);
                // $this->assign('lei',$lei);
                $this->assign('page',$show);
                $this->assign('title',$title);
                $this->display();
                break;
              case '9':  //职能总经理
                      $db = M("turn");
                      $mlist = M('auth_group')->where(['mtype'=>2])->select();

                      foreach ($mlist as $vn) {
                    
                        $ments[] =  $vn['title'];
                      

                      }
                       $where = [
                            
                                  'in',
                                  $ments
                             
                             

                          ];
                      // dump($where);
                      // exit;
                      $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'3','oa_turn.type'=>'1','oa_turn.ment'=>$where])->count();
                      $pagecount = 10;
                      $page = new \Think\Page($count , $pagecount);
                                    // $row[] = '';
                      $page->parameter = $row; //此处的row是数组，为了传递查询条件
                      $page->setConfig('first');
                      $page->setConfig('prev','上一页');
                      $page->setConfig('next','下一页');
                      $page->setConfig('last','尾页');
                      $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                      $show = $page->show();
                      $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'3','oa_turn.type'=>'1','oa_turn.ment'=>$where])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                      $title = '已被拒绝的市(内)派车申请';

                               
                      // dump($list);
                      // exit;
                      $this->assign('list',$list);
                      // $this->assign('coun',$coun);
                      // $this->assign('dao',$dao);
                      // $this->assign('lei',$lei);
                      $this->assign('page',$show);
                      $this->assign('title',$title);
                      $this->display();
                    break;




                  case '8':  //网络中心总经理
                      $db = M("turn");
                      $mlist = M('auth_group')->where(['mtype'=>1])->select();

                      foreach ($mlist as $vn) {
                      // echo $v['n_id'];
                      // exit;
                      // $ment .= "`ment`="."'".$vn['title']."'"." or ";
                      // $ment .= "'".$vn['title']."'"." , ";
                        $ments[] =  $vn['title'];
                        // 

                      }
                       $where = [
                           
                                  'in',
                                  $ments
                             

                          ];

                      $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'3','oa_turn.type'=>'1','oa_turn.ment'=>$where])->count();
                      $pagecount = 10;
                      $page = new \Think\Page($count , $pagecount);
                                    // $row[] = '';
                      $page->parameter = $row; //此处的row是数组，为了传递查询条件
                      $page->setConfig('first');
                      $page->setConfig('prev','上一页');
                      $page->setConfig('next','下一页');
                      $page->setConfig('last','尾页');
                      $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                      $show = $page->show();
                      $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'3','oa_turn.type'=>'1','oa_turn.ment'=>$where])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                      $title = '已被拒绝的市(内)派车申请';

                               
                      
                      $this->assign('list',$list);
                      // $this->assign('coun',$coun);
                      // $this->assign('dao',$dao);
                      // $this->assign('lei',$lei);
                      $this->assign('page',$show);
                      $this->assign('title',$title);
                      $this->display();
                    break;
            }

    }else{
      switch ($ulist[0]['m_type']) {
              case '2': //主管
                $db = M("turn");
                $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[2,3,4]],'oa_turn.type'=>'2','oa_turn.ment'=>$apost])->count();
                $pagecount = 10;
                $page = new \Think\Page($count , $pagecount);
                              // $row[] = '';
                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                $page->setConfig('first');
                $page->setConfig('prev','上一页');
                $page->setConfig('next','下一页');
                $page->setConfig('last','尾页');
                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                $show = $page->show();
                $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[2,3,4]],'oa_turn.type'=>'2','oa_turn.ment'=>$apost])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                $title = '已被拒绝的市(内)派车申请';

                         
                
                $this->assign('list',$list);
                // $this->assign('coun',$coun);
                // $this->assign('dao',$dao);
                // $this->assign('lei',$lei);
                $this->assign('page',$show);
                $this->assign('title',$title);
                $this->display();
                break;
              case '3': //经理
                switch ($apost) {
                        case '行政中心':
                                $db = M("turn");
                                $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[3,4]],'oa_turn.type'=>'2'])->count();
                                $pagecount = 10;
                                $page = new \Think\Page($count , $pagecount);
                                              // $row[] = '';
                                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                                $page->setConfig('first');
                                $page->setConfig('prev','上一页');
                                $page->setConfig('next','下一页');
                                $page->setConfig('last','尾页');
                                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                                $show = $page->show();
                                $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[3,4]],'oa_turn.type'=>'2'])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                                $title = '已被拒绝的市(内)派车申请';

                                         
                                
                                $this->assign('list',$list);
                                // $this->assign('coun',$coun);
                                // $this->assign('dao',$dao);
                                // $this->assign('lei',$lei);
                                $this->assign('page',$show);
                                $this->assign('title',$title);
                                $this->display();
                          break;

                        case '采购中心':
                            $db = M("turn");
                            $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[3,4]],'oa_turn.type'=>'2','oa_turn.ment'=>$apost])->count();
                            $pagecount = 10;
                            $page = new \Think\Page($count , $pagecount);
                                          // $row[] = '';
                            $page->parameter = $row; //此处的row是数组，为了传递查询条件
                            $page->setConfig('first');
                            $page->setConfig('prev','上一页');
                            $page->setConfig('next','下一页');
                            $page->setConfig('last','尾页');
                            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                            $show = $page->show();
                            $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[3,4]],'oa_turn.type'=>'2','oa_turn.ment'=>$apost])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $title = '已被拒绝的市(内)派车申请';

                                     
                            
                            $this->assign('list',$list);
                            // $this->assign('coun',$coun);
                            // $this->assign('dao',$dao);
                            // $this->assign('lei',$lei);
                            $this->assign('page',$show);
                            $this->assign('title',$title);
                            $this->display();
                          break;
                        case '财务中心':
                            $db = M("turn");
                            $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[3,4]],'oa_turn.type'=>'2','oa_turn.ment'=>$apost])->count();
                            $pagecount = 10;
                            $page = new \Think\Page($count , $pagecount);
                                          // $row[] = '';
                            $page->parameter = $row; //此处的row是数组，为了传递查询条件
                            $page->setConfig('first');
                            $page->setConfig('prev','上一页');
                            $page->setConfig('next','下一页');
                            $page->setConfig('last','尾页');
                            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                            $show = $page->show();
                            $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[3,4]],'oa_turn.type'=>'2','oa_turn.ment'=>$apost])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                            $title = '已被拒绝的市(内)派车申请';

                                     
                            
                            $this->assign('list',$list);
                            // $this->assign('coun',$coun);
                            // $this->assign('dao',$dao);
                            // $this->assign('lei',$lei);
                            $this->assign('page',$show);
                            $this->assign('title',$title);
                            $this->display();
                          break;
                        
                        
                      }
                break;
              case '4': //行政
                
                $db = M("turn");
                $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'4','oa_turn.type'=>'2'])->count();
                $pagecount = 10;
                $page = new \Think\Page($count , $pagecount);
                              // $row[] = '';
                $page->parameter = $row; //此处的row是数组，为了传递查询条件
                $page->setConfig('first');
                $page->setConfig('prev','上一页');
                $page->setConfig('next','下一页');
                $page->setConfig('last','尾页');
                $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                $show = $page->show();
                $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'4','oa_turn.type'=>'2'])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                $title = '已被拒绝的市(内)派车申请';

                         
                
                $this->assign('list',$list);
                // $this->assign('coun',$coun);
                // $this->assign('dao',$dao);
                // $this->assign('lei',$lei);
                $this->assign('page',$show);
                $this->assign('title',$title);
                $this->display();
                break;
              case '9':  //职能总经理
                      $db = M("turn");
                      $mlist = M('auth_group')->where(['mtype'=>2])->select();

                      foreach ($mlist as $vn) {
                    
                        $ments[] =  $vn['title'];
                      

                      }
                       $where = [
                            
                                  'in',
                                  $ments
                             
                             

                          ];
                      // dump($where);
                      // exit;
                      $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[3,4]],'oa_turn.type'=>'2','oa_turn.ment'=>$where])->count();
                      $pagecount = 10;
                      $page = new \Think\Page($count , $pagecount);
                                    // $row[] = '';
                      $page->parameter = $row; //此处的row是数组，为了传递查询条件
                      $page->setConfig('first');
                      $page->setConfig('prev','上一页');
                      $page->setConfig('next','下一页');
                      $page->setConfig('last','尾页');
                      $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                      $show = $page->show();
                      $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[3,4]],'oa_turn.type'=>'2','oa_turn.ment'=>$where])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                      $title = '已被拒绝的市(内)派车申请';

                               
                      // dump($list);
                      // exit;
                      $this->assign('list',$list);
                      // $this->assign('coun',$coun);
                      // $this->assign('dao',$dao);
                      // $this->assign('lei',$lei);
                      $this->assign('page',$show);
                      $this->assign('title',$title);
                      $this->display();
                    break;




                  case '8':  //网络中心总经理
                      $db = M("turn");
                      $mlist = M('auth_group')->where(['mtype'=>1])->select();

                      foreach ($mlist as $vn) {
                      // echo $v['n_id'];
                      // exit;
                      // $ment .= "`ment`="."'".$vn['title']."'"." or ";
                      // $ment .= "'".$vn['title']."'"." , ";
                        $ments[] =  $vn['title'];
                        // 

                      }
                       $where = [
                           
                                  'in',
                                  $ments
                             

                          ];

                      $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[3,4]],'oa_turn.type'=>'2','oa_turn.ment'=>$where])->count();
                      $pagecount = 10;
                      $page = new \Think\Page($count , $pagecount);
                                    // $row[] = '';
                      $page->parameter = $row; //此处的row是数组，为了传递查询条件
                      $page->setConfig('first');
                      $page->setConfig('prev','上一页');
                      $page->setConfig('next','下一页');
                      $page->setConfig('last','尾页');
                      $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                      $show = $page->show();
                      $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>['in',[3,4]],'oa_turn.type'=>'2','oa_turn.ment'=>$where])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                      $title = '已被拒绝的市(内)派车申请';

                               
                      
                      $this->assign('list',$list);
                      // $this->assign('coun',$coun);
                      // $this->assign('dao',$dao);
                      // $this->assign('lei',$lei);
                      $this->assign('page',$show);
                      $this->assign('title',$title);
                      $this->display();
                    break;


                  case '6':  //董事办
                      $db = M("turn");
                      $count = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'4','oa_turn.type'=>'2'])->count();
                      $pagecount = 10;
                      $page = new \Think\Page($count , $pagecount);
                                    // $row[] = '';
                      $page->parameter = $row; //此处的row是数组，为了传递查询条件
                      $page->setConfig('first');
                      $page->setConfig('prev','上一页');
                      $page->setConfig('next','下一页');
                      $page->setConfig('last','尾页');
                      $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
                      $show = $page->show();
                      $list = $db->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.ju'=>'4','oa_turn.type'=>'2'])->order('ment desc')->limit($page->firstRow.','.$page->listRows)->select();
                      $title = '已被拒绝的市(内)派车申请';

                               
                      
                      $this->assign('list',$list);
                      // $this->assign('coun',$coun);
                      // $this->assign('dao',$dao);
                      // $this->assign('lei',$lei);
                      $this->assign('page',$show);
                      $this->assign('title',$title);
                      $this->display();
                    break;
            }
    }
  }


 

  //删除单条信息
  public function del()
  {   

      if (M('hui')->where(['id'=>$_POST['id']])->delete() > 0) {
          echo '1111';
      }else{
          echo '2222';
      }
      
  }



  //详细信息
  public function xiang()
  {
    
    $list = M('turn')->join('oa_che as t1 on t1.sid = oa_turn.id')->where(['oa_turn.id'=>$_GET['id']])->select();
    // dump($list);
    // exit;
    if ($list[0]['type'] == 2) {
        $type = 2;
    }
    $this->assign('type',$type);
    $this->assign('list',$list);
    $this->display();
  }






  public function bushen()
  {
    // dump(I());
    // exit;
    if($_GET['type'] == '1'){
      $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
      $db = M("turn");
                  
      $count = $db->where(['look'=>8,'type'=>2,'ju'=>0,'ment'=>$ulist[0]['upost']])->count();
      // dump($count);
      // exit;
      $pagecount = 10;
      $page = new \Think\Page($count , $pagecount);
      // $row[] = '';
      $page->parameter = $row; //此处的row是数组，为了传递查询条件
      $page->setConfig('first');
      $page->setConfig('prev','上一页');
      $page->setConfig('next','下一页');
      $page->setConfig('last','尾页');
      $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
      $show = $page->show();
      $list = $db->where(['look'=>8,'type'=>2,'ju'=>0,'ment'=>$ulist[0]['upost']])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
      $title = '部门市外派车申请';
      $xing = 1;

      //---------------------------------------
                         
            
      $this->assign('list',$list);
      // $this->assign('lei',$lei);
      $this->assign('xing',$xing);
                         
      $this->assign('page',$show);
                          
      $this->assign('title',$title);
      $this->display();
    }else{
      $ulist = M('member')->where(['uid'=>$_SESSION['uid']])->select();
      $db = M("turn");
                  
      $count = $db->where(['look'=>8,'type'=>1,'ju'=>0,'ment'=>$ulist[0]['upost']])->count();
      // dump($count);
      // exit;
      $pagecount = 10;
      $page = new \Think\Page($count , $pagecount);
      // $row[] = '';
      $page->parameter = $row; //此处的row是数组，为了传递查询条件
      $page->setConfig('first');
      $page->setConfig('prev','上一页');
      $page->setConfig('next','下一页');
      $page->setConfig('last','尾页');
      $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pagecount.' 条/页 共 %TOTAL_ROW% 条)');
      $show = $page->show();
      $list = $db->where(['look'=>8,'type'=>1,'ju'=>0,'ment'=>$ulist[0]['upost']])->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
      $title = '部门市内派车申请';
      $xing = 1;

      //---------------------------------------
                         
            
      $this->assign('list',$list);
      // $this->assign('lei',$lei);
      $this->assign('xing',$xing);
                         
      $this->assign('page',$show);
                          
      $this->assign('title',$title);
      $this->display();
    }
    
  }










}